#ifndef __LowSpeedObserver_H_
#define __LowSpeedObserver_H_

typedef union
{
    int32 s32;
    int16 s16[2];
}s32tos16;
typedef struct
{    
    int16 ialp;
    int16 ialp_LSB;
    int16 ialp_pre;    
    int16 ualp;
    int16 ualp_LSB;
    int16 ealp;
    int16 ibet;
    int16 ibet_LSB;
    int16 ibet_pre;    
    int16 ubet;
    int16 ubet_LSB;
    int16 ebet;
    int16 PLLTheta;
    int16 PLLTheta1;
    int16 PLLSpeed;
    int16 Theta_pre;
    int16 PLLTheta_pre;
    int16 Theta_err;
    int16 BEMFBase_Update_Count;
    uint8 BEMFBase_Update_Count1;
    int16 Vfactor;
    int16 BEMFBase;
    int16 e_part;
    int16 e_part_LSB;
    int16 e_alp_delta;
    int16 e_bet_delta;
    int16 u_part;
    int16 u_part_LSB;    
    uint8 PLLFunctionFlag;
    int16 test;
    uint16 count;
    int16 Speed_PLL;
    int16 Speed_PLL_LSB;
    int16 Speed_PLL1;
    uint16 Switch_Count;
    int16 icom_Theta;
    uint8 icom_state;
    int16 overtest;
    int16  UBASE_Factor;
    uint8 Drv_Count;
    int16 Angle_Compen;
//    float test11;
//    float test22;
//    float test33;
}PLLVar;


extern PLLVar  data PLLfunction;
extern void PLLSoftwareFunction1(void);
extern void PLLSoftwareFunction2(int16 angle_com);
extern void PLLFunctionInit(void);
extern void PLLStateFunction(void);
extern void RampFucntion(void);
extern void PI_PLL_Init(void);
#endif